<?php
 
$url = $_GET['id'];
$data = "";

$bigarray = file("favourites.txt");
 
$fh = fopen("favourites.txt","w");
fclose($fh); 
  
foreach ($bigarray as $key => $value) 
{
   $smallarray=explode("|", $value);
  if($smallarray[0] == $url)
          {
            $bigarray[$key] = $smallarray[0] . "|" . $smallarray[1] . "|" . $smallarray[2] . "|" . ($smallarray[3]+1); 
            print_r("1".$bigarray[0]);
          }
  print_r("2".$bigarray[0]);
   }
   $fh1 = fopen("favourites.txt","a");  
   fwrite($fh1, $bigarray);
   fclose($fh1);

//echo "<meta http-equiv='Refresh' content='5;URL=" . $url . "' />";
 
?>
